<!DOCTYPE html><html><head>
      <title>java05</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      
      <link rel="stylesheet" href="file:///c:\Users\tom\.vscode\extensions\shd101wyy.markdown-preview-enhanced-0.3.13\node_modules\@shd101wyy\mume\dependencies\katex\katex.min.css">
      
      
      
      
      
      
      
      
      

      <style> 
      /**
 * prism.js Github theme based on GitHub's theme.
 * @author Sam Clarke
 */
code[class*="language-"],
pre[class*="language-"] {
  color: #333;
  background: none;
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.4;

  -moz-tab-size: 8;
  -o-tab-size: 8;
  tab-size: 8;

  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

/* Code blocks */
pre[class*="language-"] {
  padding: .8em;
  overflow: auto;
  /* border: 1px solid #ddd; */
  border-radius: 3px;
  /* background: #fff; */
  background: #f5f5f5;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
  padding: .1em;
  border-radius: .3em;
  white-space: normal;
  background: #f5f5f5;
}

.token.comment,
.token.blockquote {
  color: #969896;
}

.token.cdata {
  color: #183691;
}

.token.doctype,
.token.punctuation,
.token.variable,
.token.macro.property {
  color: #333;
}

.token.operator,
.token.important,
.token.keyword,
.token.rule,
.token.builtin {
  color: #a71d5d;
}

.token.string,
.token.url,
.token.regex,
.token.attr-value {
  color: #183691;
}

.token.property,
.token.number,
.token.boolean,
.token.entity,
.token.atrule,
.token.constant,
.token.symbol,
.token.command,
.token.code {
  color: #0086b3;
}

.token.tag,
.token.selector,
.token.prolog {
  color: #63a35c;
}

.token.function,
.token.namespace,
.token.pseudo-element,
.token.class,
.token.class-name,
.token.pseudo-class,
.token.id,
.token.url-reference .token.variable,
.token.attr-name {
  color: #795da3;
}

.token.entity {
  cursor: help;
}

.token.title,
.token.title .token.punctuation {
  font-weight: bold;
  color: #1d3e81;
}

.token.list {
  color: #ed6a43;
}

.token.inserted {
  background-color: #eaffea;
  color: #55a532;
}

.token.deleted {
  background-color: #ffecec;
  color: #bd2c00;
}

.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}


/* JSON */
.language-json .token.property {
  color: #183691;
}

.language-markup .token.tag .token.punctuation {
  color: #333;
}

/* CSS */
code.language-css,
.language-css .token.function {
  color: #0086b3;
}

/* YAML */
.language-yaml .token.atrule {
  color: #63a35c;
}

code.language-yaml {
  color: #183691;
}

/* Ruby */
.language-ruby .token.function {
  color: #333;
}

/* Markdown */
.language-markdown .token.url {
  color: #795da3;
}

/* Makefile */
.language-makefile .token.symbol {
  color: #795da3;
}

.language-makefile .token.variable {
  color: #183691;
}

.language-makefile .token.builtin {
  color: #0086b3;
}

/* Bash */
.language-bash .token.keyword {
  color: #0086b3;
}

/* highlight */
pre[data-line] {
  position: relative;
  padding: 1em 0 1em 3em;
}
pre[data-line] .line-highlight-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  background-color: transparent;
  display: block;
  width: 100%;
}

pre[data-line] .line-highlight {
  position: absolute;
  left: 0;
  right: 0;
  padding: inherit 0;
  margin-top: 1em;
  background: hsla(24, 20%, 50%,.08);
  background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
  pointer-events: none;
  line-height: inherit;
  white-space: pre;
}

pre[data-line] .line-highlight:before, 
pre[data-line] .line-highlight[data-end]:after {
  content: attr(data-start);
  position: absolute;
  top: .4em;
  left: .6em;
  min-width: 1em;
  padding: 0 .5em;
  background-color: hsla(24, 20%, 50%,.4);
  color: hsl(24, 20%, 95%);
  font: bold 65%/1.5 sans-serif;
  text-align: center;
  vertical-align: .3em;
  border-radius: 999px;
  text-shadow: none;
  box-shadow: 0 1px white;
}

pre[data-line] .line-highlight[data-end]:after {
  content: attr(data-end);
  top: auto;
  bottom: .4em;
}html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]) .code-chunk .status{display:none}.markdown-preview:not([for="preview"]) .code-chunk .output-div{margin-bottom:16px}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0}@media screen and (min-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px)}}@media screen and (max-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{font-size:14px !important;padding:1em}}@media print{html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,0.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{padding:0 1.6em;margin-top:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc li{margin-bottom:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{list-style-type:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% -  300px);padding:2em calc(50% - 457px -  150px);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
/* Please visit the URL below for more information: */
/*   https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
 
      </style>
    </head>
    <body for="html-export">
      <div class="mume markdown-preview   ">
      <ul>
<li><a href="#1%E6%96%B9%E6%B3%95%E6%8E%8C%E6%8F%A1">1:&#x65B9;&#x6CD5;(&#x638C;&#x63E1;)</a><br>
* <a href="#1%E6%96%B9%E6%B3%95%E5%B0%B1%E6%98%AF%E5%AE%8C%E6%88%90%E7%89%B9%E5%AE%9A%E5%8A%9F%E8%83%BD%E7%9A%84%E4%BB%A3%E7%A0%81%E5%9D%97">(1)&#x65B9;&#x6CD5;&#xFF1A;&#x5C31;&#x662F;&#x5B8C;&#x6210;&#x7279;&#x5B9A;&#x529F;&#x80FD;&#x7684;&#x4EE3;&#x7801;&#x5757;&#x3002;</a><br>
* <a href="#2%E6%A0%BC%E5%BC%8F">(2)&#x683C;&#x5F0F;&#xFF1A;</a><br>
* <a href="#3%E4%B8%A4%E4%B8%AA%E6%98%8E%E7%A1%AE">(3)&#x4E24;&#x4E2A;&#x660E;&#x786E;&#xFF1A;</a><br>
* <a href="#4%E6%96%B9%E6%B3%95%E8%B0%83%E7%94%A8">(4)&#x65B9;&#x6CD5;&#x8C03;&#x7528;</a><br>
* <a href="#a%E6%9C%89%E6%98%8E%E7%A1%AE%E8%BF%94%E5%9B%9E%E5%80%BC%E7%9A%84%E6%96%B9%E6%B3%95">A:&#x6709;&#x660E;&#x786E;&#x8FD4;&#x56DE;&#x503C;&#x7684;&#x65B9;&#x6CD5;</a><br>
* <a href="#bvoid%E7%B1%BB%E5%9E%8B%E4%BF%AE%E9%A5%B0%E7%9A%84%E6%96%B9%E6%B3%95">B:void&#x7C7B;&#x578B;&#x4FEE;&#x9970;&#x7684;&#x65B9;&#x6CD5;</a><br>
* <a href="#5%E6%A1%88%E4%BE%8B">(5)&#x6848;&#x4F8B;&#xFF1A;</a><br>
* <a href="#6%E6%96%B9%E6%B3%95%E7%9A%84%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9">(6)&#x65B9;&#x6CD5;&#x7684;&#x6CE8;&#x610F;&#x4E8B;&#x9879;</a><br>
* <a href="#7%E6%96%B9%E6%B3%95%E9%87%8D%E8%BD%BD">(7)&#x65B9;&#x6CD5;&#x91CD;&#x8F7D;</a><br>
* <a href="#8%E6%96%B9%E6%B3%95%E9%87%8D%E8%BD%BD%E6%A1%88%E4%BE%8B">(8)&#x65B9;&#x6CD5;&#x91CD;&#x8F7D;&#x6848;&#x4F8B;</a></li>
<li><a href="#2%E6%95%B0%E7%BB%84%E6%8E%8C%E6%8F%A1">2:&#x6570;&#x7EC4;(&#x638C;&#x63E1;)</a><br>
* <a href="#1%E6%95%B0%E7%BB%84%E5%AD%98%E5%82%A8%E5%90%8C%E4%B8%80%E7%A7%8D%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E7%9A%84%E5%A4%9A%E4%B8%AA%E5%85%83%E7%B4%A0%E7%9A%84%E5%AE%B9%E5%99%A8">(1)&#x6570;&#x7EC4;&#xFF1A;&#x5B58;&#x50A8;&#x540C;&#x4E00;&#x79CD;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x7684;&#x591A;&#x4E2A;&#x5143;&#x7D20;&#x7684;&#x5BB9;&#x5668;&#x3002;</a><br>
* <a href="#2%E7%89%B9%E7%82%B9%E6%AF%8F%E4%B8%80%E4%B8%AA%E5%85%83%E7%B4%A0%E9%83%BD%E6%9C%89%E7%BC%96%E5%8F%B7%E4%BB%8E0%E5%BC%80%E5%A7%8B%E6%9C%80%E5%A4%A7%E7%BC%96%E5%8F%B7%E6%98%AF%E9%95%BF%E5%BA%A6-1">(2)&#x7279;&#x70B9;&#xFF1A;&#x6BCF;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x90FD;&#x6709;&#x7F16;&#x53F7;&#xFF0C;&#x4ECE;0&#x5F00;&#x59CB;&#xFF0C;&#x6700;&#x5927;&#x7F16;&#x53F7;&#x662F;&#x957F;&#x5EA6;-1&#x3002;</a><br>
* <a href="#3%E5%AE%9A%E4%B9%89%E6%A0%BC%E5%BC%8F">(3)&#x5B9A;&#x4E49;&#x683C;&#x5F0F;</a><br>
* <a href="#4%E6%95%B0%E7%BB%84%E7%9A%84%E5%88%9D%E5%A7%8B%E5%8C%96">(4)&#x6570;&#x7EC4;&#x7684;&#x521D;&#x59CB;&#x5316;</a><br>
* <a href="#5java%E7%9A%84%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D">(5)Java&#x7684;&#x5185;&#x5B58;&#x5206;&#x914D;</a><br>
* <a href="#6%E6%95%B0%E7%BB%84%E5%86%85%E5%AD%98%E5%9B%BE">(6)&#x6570;&#x7EC4;&#x5185;&#x5B58;&#x56FE;</a><br>
* <a href="#7%E6%95%B0%E7%BB%84%E7%9A%84%E5%B8%B8%E8%A7%81%E6%93%8D%E4%BD%9C">(7)&#x6570;&#x7EC4;&#x7684;&#x5E38;&#x89C1;&#x64CD;&#x4F5C;</a><br>
* <a href="#a%E9%81%8D%E5%8E%86">A:&#x904D;&#x5386;</a><br>
* <a href="#b%E6%9C%80%E5%80%BC">B:&#x6700;&#x503C;</a><br>
* <a href="#c%E9%80%86%E5%BA%8F">C:&#x9006;&#x5E8F;</a><br>
* <a href="#d%E6%9F%A5%E8%A1%A8">D:&#x67E5;&#x8868;</a><br>
* <a href="#e%E5%9F%BA%E6%9C%AC%E6%9F%A5%E6%89%BE">E:&#x57FA;&#x672C;&#x67E5;&#x627E;</a></li>
</ul>
<h2 class="mume-header" id="1%E6%96%B9%E6%B3%95%E6%8E%8C%E6%8F%A1">1:&#x65B9;&#x6CD5;(&#x638C;&#x63E1;)</h2>

<h4 class="mume-header" id="1%E6%96%B9%E6%B3%95%E5%B0%B1%E6%98%AF%E5%AE%8C%E6%88%90%E7%89%B9%E5%AE%9A%E5%8A%9F%E8%83%BD%E7%9A%84%E4%BB%A3%E7%A0%81%E5%9D%97">(1)&#x65B9;&#x6CD5;&#xFF1A;&#x5C31;&#x662F;&#x5B8C;&#x6210;&#x7279;&#x5B9A;&#x529F;&#x80FD;&#x7684;&#x4EE3;&#x7801;&#x5757;&#x3002;</h4>

<p>&#x6CE8;&#x610F;&#xFF1A;&#x5728;&#x5F88;&#x591A;&#x8BED;&#x8A00;&#x91CC;&#x9762;&#x6709;&#x51FD;&#x6570;&#x7684;&#x5B9A;&#x4E49;&#xFF0C;&#x800C;&#x5728;Java&#x4E2D;&#xFF0C;&#x51FD;&#x6570;&#x88AB;&#x79F0;&#x4E3A;&#x65B9;&#x6CD5;&#x3002;</p>
<h4 class="mume-header" id="2%E6%A0%BC%E5%BC%8F">(2)&#x683C;&#x5F0F;&#xFF1A;</h4>

<pre data-role="codeBlock" data-info class="language-"><code>&#x4FEE;&#x9970;&#x7B26; &#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B; &#x65B9;&#x6CD5;&#x540D;(&#x53C2;&#x6570;&#x7C7B;&#x578B; &#x53C2;&#x6570;&#x540D;1,&#x53C2;&#x6570;&#x7C7B;&#x578B; &#x53C2;&#x6570;&#x540D;2...) {
    &#x65B9;&#x6CD5;&#x4F53;&#x8BED;&#x53E5;;
    return &#x8FD4;&#x56DE;&#x503C;;
}
</code></pre><ul>
<li>&#x4FEE;&#x9970;&#x7B26;&#xFF1A;&#x76EE;&#x524D;&#x5C31;&#x7528; <code>public</code> <code>static</code>&#x3002;&#x540E;&#x9762;&#x518D;&#x8BE6;&#x7EC6;&#x8BB2;&#x89E3;&#x5176;&#x4ED6;&#x4FEE;&#x9970;&#x7B26;</li>
<li>&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#xFF1A;&#x5C31;&#x662F;&#x529F;&#x80FD;&#x7ED3;&#x679C;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;</li>
<li>&#x65B9;&#x6CD5;&#x540D;&#xFF1A;&#x5C31;&#x662F;&#x8D77;&#x4E86;&#x4E00;&#x4E2A;&#x540D;&#x5B57;&#xFF0C;&#x65B9;&#x4FBF;&#x6211;&#x4EEC;&#x8C03;&#x7528;&#x8BE5;&#x65B9;&#x6CD5;&#x3002;</li>
<li>&#x53C2;&#x6570;&#x7C7B;&#x578B;&#xFF1A;&#x5C31;&#x662F;&#x53C2;&#x6570;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;</li>
<li>&#x53C2;&#x6570;&#x540D;&#xFF1A;&#x5C31;&#x662F;&#x53D8;&#x91CF;</li>
<li>&#x53C2;&#x6570;&#x5206;&#x7C7B;&#xFF1A;
<ul>
<li>&#x5B9E;&#x53C2;&#xFF1A;&#x5B9E;&#x9645;&#x53C2;&#x4E0E;&#x8FD0;&#x7B97;&#x7684;&#x6570;&#x636E;</li>
<li>&#x5F62;&#x53C2;&#xFF1A;&#x65B9;&#x6CD5;&#x4E0A;&#x5B9A;&#x4E49;&#x7684;&#xFF0C;&#x7528;&#x4E8E;&#x63A5;&#x6536;&#x5B9E;&#x9645;&#x53C2;&#x6570;&#x7684;&#x53D8;&#x91CF;</li>
</ul>
</li>
<li>&#x65B9;&#x6CD5;&#x4F53;&#x8BED;&#x53E5;&#xFF1A;&#x5C31;&#x662F;&#x5B8C;&#x6210;&#x529F;&#x80FD;&#x7684;&#x4EE3;&#x7801;&#x5757;</li>
<li><code>return</code>&#xFF1A;&#x7ED3;&#x675F;&#x65B9;&#x6CD5;</li>
<li>&#x8FD4;&#x56DE;&#x503C;&#xFF1A;&#x5C31;&#x662F;&#x529F;&#x80FD;&#x7684;&#x7ED3;&#x679C;&#xFF0C;&#x7531;return&#x5E26;&#x7ED9;&#x8C03;&#x7528;&#x8005;&#x3002;</li>
</ul>
<h4 class="mume-header" id="3%E4%B8%A4%E4%B8%AA%E6%98%8E%E7%A1%AE">(3)&#x4E24;&#x4E2A;&#x660E;&#x786E;&#xFF1A;</h4>

<p>&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#xFF1A;&#x7ED3;&#x679C;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;<br>
&#x53C2;&#x6570;&#x5217;&#x8868;&#xFF1A;&#x53C2;&#x6570;&#x7684;&#x4E2A;&#x6570;&#x53CA;&#x5BF9;&#x5E94;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;</p>
<h4 class="mume-header" id="4%E6%96%B9%E6%B3%95%E8%B0%83%E7%94%A8">(4)&#x65B9;&#x6CD5;&#x8C03;&#x7528;</h4>

<h6 class="mume-header" id="a%E6%9C%89%E6%98%8E%E7%A1%AE%E8%BF%94%E5%9B%9E%E5%80%BC%E7%9A%84%E6%96%B9%E6%B3%95">A:&#x6709;&#x660E;&#x786E;&#x8FD4;&#x56DE;&#x503C;&#x7684;&#x65B9;&#x6CD5;</h6>

<ul>
<li>a:&#x5355;&#x72EC;&#x8C03;&#x7528;&#xFF0C;&#x6CA1;&#x6709;&#x610F;&#x4E49;</li>
<li>b:&#x8F93;&#x51FA;&#x8C03;&#x7528;&#xFF0C;&#x4E0D;&#x662F;&#x5F88;&#x597D;&#xFF0C;&#x56E0;&#x4E3A;&#x6211;&#x53EF;&#x80FD;&#x9700;&#x8981;&#x4E0D;&#x7ED3;&#x679C;&#x8FDB;&#x884C;&#x8FDB;&#x4E00;&#x6B65;&#x7684;&#x64CD;&#x4F5C;&#x3002;&#x4F46;&#x662F;&#x8BB2;&#x8BFE;&#x4E00;&#x822C;&#x6211;&#x5C31;&#x7528;&#x4E86;&#x3002;</li>
<li>c:&#x8D4B;&#x503C;&#x8C03;&#x7528;&#xFF0C;&#x63A8;&#x8350;&#x65B9;&#x6848;</li>
</ul>
<h6 class="mume-header" id="bvoid%E7%B1%BB%E5%9E%8B%E4%BF%AE%E9%A5%B0%E7%9A%84%E6%96%B9%E6%B3%95">B:void&#x7C7B;&#x578B;&#x4FEE;&#x9970;&#x7684;&#x65B9;&#x6CD5;</h6>

<ul>
<li>a:&#x5355;&#x72EC;&#x8C03;&#x7528;</li>
</ul>
<h4 class="mume-header" id="5%E6%A1%88%E4%BE%8B">(5)&#x6848;&#x4F8B;&#xFF1A;</h4>

<pre class="language-text">A:&#x6C42;&#x548C;&#x65B9;&#x6848;
B:&#x83B7;&#x53D6;&#x4E24;&#x4E2A;&#x6570;&#x4E2D;&#x7684;&#x8F83;&#x5927;&#x503C;
C:&#x6BD4;&#x8F83;&#x4E24;&#x4E2A;&#x6570;&#x636E;&#x662F;&#x5426;&#x76F8;&#x540C;
D:&#x83B7;&#x53D6;&#x4E09;&#x4E2A;&#x6570;&#x4E2D;&#x7684;&#x6700;&#x5927;&#x503C;
E:&#x8F93;&#x51FA;m&#x884C;n&#x5217;&#x7684;&#x661F;&#x5F62;
F:&#x8F93;&#x51FA;nn&#x4E58;&#x6CD5;&#x8868;
</pre>
<h4 class="mume-header" id="6%E6%96%B9%E6%B3%95%E7%9A%84%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9">(6)&#x65B9;&#x6CD5;&#x7684;&#x6CE8;&#x610F;&#x4E8B;&#x9879;</h4>

<ul>
<li>A:&#x65B9;&#x6CD5;&#x4E0D;&#x8C03;&#x7528;&#x4E0D;&#x6267;&#x884C;</li>
<li>B:&#x65B9;&#x6CD5;&#x4E4B;&#x95F4;&#x662F;&#x5E73;&#x7EA7;&#x5173;&#x7CFB;&#xFF0C;&#x4E0D;&#x80FD;&#x5D4C;&#x5957;&#x5B9A;&#x4E49;</li>
<li>C:&#x65B9;&#x6CD5;&#x5B9A;&#x4E49;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x53C2;&#x6570;&#x662F;&#x7528;&#xFF0C;&#x9694;&#x5F00;&#x7684;</li>
<li>D:&#x65B9;&#x6CD5;&#x5728;&#x8C03;&#x7528;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4E0D;&#x7528;&#x5728;&#x4F20;&#x9012;&#x6570;&#x636E;&#x7C7B;&#x578B;</li>
<li>E:&#x5982;&#x679C;&#x65B9;&#x6CD5;&#x6709;&#x660E;&#x786E;&#x7684;&#x8FD4;&#x56DE;&#x503C;&#x7C7B;&#x578B;&#xFF0C;&#x5C31;&#x5FC5;&#x987B;&#x6709;<code>return</code>&#x8BED;&#x53E5;&#x8FD4;&#x56DE;&#x3002;</li>
</ul>
<h4 class="mume-header" id="7%E6%96%B9%E6%B3%95%E9%87%8D%E8%BD%BD">(7)&#x65B9;&#x6CD5;&#x91CD;&#x8F7D;</h4>

<p>&#x5728;&#x540C;&#x4E00;&#x4E2A;&#x7C7B;&#x4E2D;&#xFF0C;&#x65B9;&#x6CD5;&#x540D;&#x76F8;&#x540C;&#xFF0C;&#x53C2;&#x6570;&#x5217;&#x8868;&#x4E0D;&#x540C;&#x3002;&#x4E0E;&#x8FD4;&#x56DE;&#x503C;&#x65E0;&#x5173;&#x3002;<br>
&#x53C2;&#x6570;&#x5217;&#x8868;&#x4E0D;&#x540C;&#xFF1A;</p>
<ul>
<li>&#x53C2;&#x6570;&#x7684;&#x4E2A;&#x6570;&#x4E0D;&#x540C;&#x3002;</li>
<li>&#x53C2;&#x6570;&#x7684;&#x5BF9;&#x5E94;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x4E0D;&#x540C;&#x3002;</li>
</ul>
<h4 class="mume-header" id="8%E6%96%B9%E6%B3%95%E9%87%8D%E8%BD%BD%E6%A1%88%E4%BE%8B">(8)&#x65B9;&#x6CD5;&#x91CD;&#x8F7D;&#x6848;&#x4F8B;</h4>

<p>&#x4E0D;&#x540C;&#x7684;&#x7C7B;&#x578B;&#x7684;&#x591A;&#x4E2A;&#x540C;&#x540D;&#x65B9;&#x6CD5;&#x7684;&#x6BD4;&#x8F83;&#x3002;</p>
<h2 class="mume-header" id="2%E6%95%B0%E7%BB%84%E6%8E%8C%E6%8F%A1">2:&#x6570;&#x7EC4;(&#x638C;&#x63E1;)</h2>

<h4 class="mume-header" id="1%E6%95%B0%E7%BB%84%E5%AD%98%E5%82%A8%E5%90%8C%E4%B8%80%E7%A7%8D%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E7%9A%84%E5%A4%9A%E4%B8%AA%E5%85%83%E7%B4%A0%E7%9A%84%E5%AE%B9%E5%99%A8">(1)&#x6570;&#x7EC4;&#xFF1A;&#x5B58;&#x50A8;&#x540C;&#x4E00;&#x79CD;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x7684;&#x591A;&#x4E2A;&#x5143;&#x7D20;&#x7684;&#x5BB9;&#x5668;&#x3002;</h4>

<h4 class="mume-header" id="2%E7%89%B9%E7%82%B9%E6%AF%8F%E4%B8%80%E4%B8%AA%E5%85%83%E7%B4%A0%E9%83%BD%E6%9C%89%E7%BC%96%E5%8F%B7%E4%BB%8E0%E5%BC%80%E5%A7%8B%E6%9C%80%E5%A4%A7%E7%BC%96%E5%8F%B7%E6%98%AF%E9%95%BF%E5%BA%A6-1">(2)&#x7279;&#x70B9;&#xFF1A;&#x6BCF;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x90FD;&#x6709;&#x7F16;&#x53F7;&#xFF0C;&#x4ECE;0&#x5F00;&#x59CB;&#xFF0C;&#x6700;&#x5927;&#x7F16;&#x53F7;&#x662F;&#x957F;&#x5EA6;-1&#x3002;</h4>

<p>&#x7F16;&#x53F7;&#x7684;&#x4E13;&#x4E1A;&#x53EB;&#x6CD5;&#xFF1A;&#x7D22;&#x5F15;</p>
<h4 class="mume-header" id="3%E5%AE%9A%E4%B9%89%E6%A0%BC%E5%BC%8F">(3)&#x5B9A;&#x4E49;&#x683C;&#x5F0F;</h4>

<ul>
<li>A:&#x6570;&#x636E;&#x7C7B;&#x578B;[] &#x6570;&#x7EC4;&#x540D;;</li>
<li>B:&#x6570;&#x636E;&#x7C7B;&#x578B; &#x6570;&#x7EC4;&#x540D;[];</li>
</ul>
<p>&#x63A8;&#x8350;&#x662F;&#x7528;A&#x65B9;&#x5F0F;&#xFF0C;B&#x65B9;&#x6CD5;&#x5C31;&#x5FD8;&#x4E86;&#x5427;&#x3002;<br>
&#x4F46;&#x662F;&#x8981;&#x80FD;&#x770B;&#x61C2;</p>
<h4 class="mume-header" id="4%E6%95%B0%E7%BB%84%E7%9A%84%E5%88%9D%E5%A7%8B%E5%8C%96">(4)&#x6570;&#x7EC4;&#x7684;&#x521D;&#x59CB;&#x5316;</h4>

<ul>
<li>A:&#x52A8;&#x6001;&#x521D;&#x59CB;&#x5316;<br>
&#x53EA;&#x7ED9;&#x957F;&#x5EA6;&#xFF0C;&#x7CFB;&#x7EDF;&#x7ED9;&#x51FA;&#x9ED8;&#x8BA4;&#x503C;		<br>
&#x4E3E;&#x4F8B;&#xFF1A;<code>int[] arr = new int[3];</code></li>
<li>B:&#x9759;&#x6001;&#x521D;&#x59CB;&#x5316;<br>
&#x7ED9;&#x51FA;&#x503C;&#xFF0C;&#x7CFB;&#x7EDF;&#x51B3;&#x5B9A;&#x957F;&#x5EA6;			<br>
&#x4E3E;&#x4F8B;&#xFF1A;<code>int[] arr = new int[]{1,2,3};</code><br>
&#x7B80;&#x5316;&#x7248;&#xFF1A;<code>int[] arr = {1,2,3};</code></li>
</ul>
<h4 class="mume-header" id="5java%E7%9A%84%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D">(5)Java&#x7684;&#x5185;&#x5B58;&#x5206;&#x914D;</h4>

<ul>
<li>A:&#x6808; &#x5B58;&#x50A8;&#x5C40;&#x90E8;&#x53D8;&#x91CF;</li>
<li>B:&#x5806; &#x5B58;&#x50A8;&#x6240;&#x6709;new&#x51FA;&#x6765;&#x7684;</li>
<li>C:&#x65B9;&#x6CD5;&#x533A;(&#x9762;&#x5411;&#x5BF9;&#x8C61;&#x90E8;&#x5206;&#x8BE6;&#x7EC6;&#x8BB2;&#x89E3;)</li>
<li>D:&#x672C;&#x5730;&#x65B9;&#x6CD5;&#x533A;(&#x7CFB;&#x7EDF;&#x76F8;&#x5173;)</li>
<li>E:&#x5BC4;&#x5B58;&#x5668;(CPU&#x4F7F;&#x7528;)</li>
</ul>
<p>&#x6CE8;&#x610F;&#xFF1A;<br>
a:&#x5C40;&#x90E8;&#x53D8;&#x91CF; &#x5728;&#x65B9;&#x6CD5;&#x5B9A;&#x4E49;&#x4E2D;&#x6216;&#x8005;&#x65B9;&#x6CD5;&#x58F0;&#x660E;&#x4E0A;&#x5B9A;&#x4E49;&#x7684;&#x53D8;&#x91CF;&#x3002;<br>
b:&#x6808;&#x5185;&#x5B58;&#x548C;&#x5806;&#x5185;&#x5B58;&#x7684;&#x533A;&#x522B;<br>
&#x6808;&#xFF1A;&#x6570;&#x636E;&#x4F7F;&#x7528;&#x5B8C;&#x6BD5;&#xFF0C;&#x5C31;&#x6D88;&#x5931;&#x3002;<br>
&#x5806;&#xFF1A;&#x6BCF;&#x4E00;&#x4E2A;new&#x51FA;&#x6765;&#x7684;&#x4E1C;&#x897F;&#x90FD;&#x6709;&#x5730;&#x5740;<br>
&#x6BCF;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x90FD;&#x6709;&#x9ED8;&#x8BA4;&#x503C;<br>
<code>byte</code>,<code>short</code>,<code>int</code>,<code>long</code> 0<br>
<code>float</code>,<code>double</code> 0.0<br>
<code>char</code> <code>&apos;\u0000&apos;</code><br>
<code>boolean</code> <code>false</code><br>
&#x5F15;&#x7528;&#x7C7B;&#x578B; <code>null</code><br>
&#x6570;&#x636E;&#x4F7F;&#x7528;&#x5B8C;&#x6BD5;&#x540E;&#xFF0C;&#x5728;&#x5783;&#x573E;&#x56DE;&#x6536;&#x5668;&#x7A7A;&#x95F2;&#x7684;&#x65F6;&#x5019;&#x56DE;&#x6536;&#x3002;</p>
<h4 class="mume-header" id="6%E6%95%B0%E7%BB%84%E5%86%85%E5%AD%98%E5%9B%BE">(6)&#x6570;&#x7EC4;&#x5185;&#x5B58;&#x56FE;</h4>

<pre class="language-text">A:&#x4E00;&#x4E2A;&#x6570;&#x7EC4;
B:&#x4E8C;&#x4E2A;&#x6570;&#x7EC4;
C:&#x4E09;&#x4E2A;&#x6570;&#x7EC4;(&#x4E24;&#x4E2A;&#x6808;&#x53D8;&#x91CF;&#x6307;&#x5411;&#x540C;&#x4E00;&#x4E2A;&#x5806;&#x5185;&#x5B58;)
</pre>
<h4 class="mume-header" id="7%E6%95%B0%E7%BB%84%E7%9A%84%E5%B8%B8%E8%A7%81%E6%93%8D%E4%BD%9C">(7)&#x6570;&#x7EC4;&#x7684;&#x5E38;&#x89C1;&#x64CD;&#x4F5C;</h4>

<h6 class="mume-header" id="a%E9%81%8D%E5%8E%86">A:&#x904D;&#x5386;</h6>

<p>&#x65B9;&#x5F0F;1&#xFF1A;</p>
<pre data-role="codeBlock" data-info="java" class="language-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">printArray</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span> arr<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> x<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> x<span class="token operator">&lt;</span>arr<span class="token punctuation">.</span>length<span class="token punctuation">;</span> x<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</pre><p>&#x65B9;&#x5F0F;2&#xFF1A;</p>
<pre data-role="codeBlock" data-info="java" class="language-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">printArray</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span> arr<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">print</span><span class="token punctuation">(</span><span class="token string">&quot;[&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> x<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> x<span class="token operator">&lt;</span>arr<span class="token punctuation">.</span>length<span class="token punctuation">;</span> x<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>x <span class="token operator">==</span> arr<span class="token punctuation">.</span>length<span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span><span class="token operator">+</span><span class="token string">&quot;]&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span><span class="token keyword">else</span> <span class="token punctuation">{</span>
            <span class="token class-name">System</span><span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span><span class="token operator">+</span><span class="token string">&quot;, &quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</pre><h6 class="mume-header" id="b%E6%9C%80%E5%80%BC">B:&#x6700;&#x503C;</h6>

<p>&#x6700;&#x5927;&#x503C;&#xFF1A;</p>
<pre data-role="codeBlock" data-info="java" class="language-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">int</span> <span class="token function">getMax</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span> arr<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">int</span> max <span class="token operator">=</span> arr<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> x<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span> x<span class="token operator">&lt;</span>arr<span class="token punctuation">.</span>length<span class="token punctuation">;</span> x<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span> <span class="token operator">&gt;</span> max<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            max <span class="token operator">=</span> arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    
    <span class="token keyword">return</span> max<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</pre><p>&#x6700;&#x5C0F;&#x503C;&#xFF1A;</p>
<pre data-role="codeBlock" data-info="java" class="language-java">    <span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">int</span> <span class="token function">getMin</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span> arr<span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">int</span> min <span class="token operator">=</span> arr<span class="token punctuation">[</span><span class="token number">0</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
        
        <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> x<span class="token operator">=</span><span class="token number">1</span><span class="token punctuation">;</span> x<span class="token operator">&lt;</span>arr<span class="token punctuation">.</span>length<span class="token punctuation">;</span> x<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">if</span><span class="token punctuation">(</span>arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span> <span class="token operator">&lt;</span> min<span class="token punctuation">)</span> <span class="token punctuation">{</span>
                min <span class="token operator">=</span> arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span><span class="token punctuation">;</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
        
        <span class="token keyword">return</span> min<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
</pre><h6 class="mume-header" id="c%E9%80%86%E5%BA%8F">C:&#x9006;&#x5E8F;</h6>

<p>&#x65B9;&#x5F0F;1&#xFF1A;</p>
<pre data-role="codeBlock" data-info="java" class="language-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">reverse</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span> arr<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> x<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> x<span class="token operator">&lt;</span>arr<span class="token punctuation">.</span>length<span class="token operator">/</span><span class="token number">2</span><span class="token punctuation">;</span> x<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">int</span> temp <span class="token operator">=</span> arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span><span class="token punctuation">;</span>
        arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span> <span class="token operator">=</span> arr<span class="token punctuation">[</span>arr<span class="token punctuation">.</span>length<span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span>x<span class="token punctuation">]</span><span class="token punctuation">;</span>
        arr<span class="token punctuation">[</span>arr<span class="token punctuation">.</span>length<span class="token operator">-</span><span class="token number">1</span><span class="token operator">-</span>x<span class="token punctuation">]</span> <span class="token operator">=</span> temp<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</pre><p>&#x65B9;&#x5F0F;2&#xFF1A;</p>
<pre data-role="codeBlock" data-info="java" class="language-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">reverse</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span> arr<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> start<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">,</span>end<span class="token operator">=</span>arr<span class="token punctuation">.</span>length<span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span> start<span class="token operator">&lt;=</span>end<span class="token punctuation">;</span> start<span class="token operator">++</span><span class="token punctuation">,</span>end<span class="token operator">--</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">int</span> temp <span class="token operator">=</span> arr<span class="token punctuation">[</span>start<span class="token punctuation">]</span><span class="token punctuation">;</span>
        arr<span class="token punctuation">[</span>start<span class="token punctuation">]</span> <span class="token operator">=</span> arr<span class="token punctuation">[</span>end<span class="token punctuation">]</span><span class="token punctuation">;</span>
        arr<span class="token punctuation">[</span>end<span class="token punctuation">]</span> <span class="token operator">=</span> temp<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</pre><h6 class="mume-header" id="d%E6%9F%A5%E8%A1%A8">D:&#x67E5;&#x8868;</h6>

<pre data-role="codeBlock" data-info="java" class="language-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token class-name">String</span> <span class="token function">getString</span><span class="token punctuation">(</span><span class="token class-name">String</span><span class="token punctuation">[</span><span class="token punctuation">]</span> strArray<span class="token punctuation">,</span><span class="token keyword">int</span> index<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> strArray<span class="token punctuation">[</span>index<span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</pre><h6 class="mume-header" id="e%E5%9F%BA%E6%9C%AC%E6%9F%A5%E6%89%BE">E:&#x57FA;&#x672C;&#x67E5;&#x627E;</h6>

<p>&#x65B9;&#x5F0F;1&#xFF1A;</p>
<pre data-role="codeBlock" data-info="java" class="language-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">int</span> <span class="token function">getIndex</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span> arr<span class="token punctuation">,</span><span class="token keyword">int</span> value<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> x<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> x<span class="token operator">&lt;</span>arr<span class="token punctuation">.</span>length<span class="token punctuation">;</span> x<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span> <span class="token operator">==</span> value<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            <span class="token keyword">return</span> x<span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    
    <span class="token keyword">return</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</pre><p>&#x65B9;&#x5F0F;2&#xFF1A;</p>
<pre data-role="codeBlock" data-info="java" class="language-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">int</span> <span class="token function">getIndex</span><span class="token punctuation">(</span><span class="token keyword">int</span><span class="token punctuation">[</span><span class="token punctuation">]</span> arr<span class="token punctuation">,</span><span class="token keyword">int</span> value<span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">int</span> index <span class="token operator">=</span> <span class="token operator">-</span><span class="token number">1</span><span class="token punctuation">;</span>

    <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> x<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> x<span class="token operator">&lt;</span>arr<span class="token punctuation">.</span>length<span class="token punctuation">;</span> x<span class="token operator">++</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>arr<span class="token punctuation">[</span>x<span class="token punctuation">]</span> <span class="token operator">==</span> value<span class="token punctuation">)</span> <span class="token punctuation">{</span>
            index <span class="token operator">=</span> x<span class="token punctuation">;</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
    
    <span class="token keyword">return</span> index<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</pre>
      </div>
      
      
    
    
    
    
    
    
    
    
  
    </body></html>